\section{eig --- Eigen Decomposition}
\label{fn:eig}
\index{eig()}
\index{eigen decomposition}
\begin{rail}
Eigen : 'eig' '(' ( Matrix | Matrix ',' Matrix ) ')' ;
\end{rail}

\verb+eig+ with a single square argument matrix computes that matrix's
eigenvectors and eigenvalues. The results are returned as a list with
elements \verb+val+ and \verb+vec+ which are the eigenvalues and
right eigenvectors respectively. In general, these will be
complex quantities.  

\verb+eig+ with two arguments computes the eigenvectors and 
eigenvalues of the real generalized symmetric ( or complex generalized
Hermitian) definite eigenproblem. The eigenvalues and eigenvectors are
returned in a list as for the first form.  If the two arguments are
$A$ and $B$, the eigenproblem is defined by

\[ Ax = \lambda B x \]

Both forms of \verb+eig+  check for symmetry, and use an
appropriate solver.

\paragraph{Example}
\index{example of eig()}
\index{eig()!example}
\begin{verbatim}
> A = rand(3,3)
 A =
    0.108      0.741     0.0646  
    0.297      0.329     0.0287  
    0.254      0.345      0.499  
> eigen= eig(A)
 eigen =
   val          vec          
> A* eigen.vec[;1] - eigen.val[1]*eigen.vec[;1]
           1.39e-16 + 0i
          -1.11e-16 + 0i
           4.86e-17 + 0i
> A* eigen.vec[;2] - eigen.val[2]*eigen.vec[;2]
           1.11e-16 + 0i
          -3.33e-16 + 0i
          -1.11e-16 + 0i
> A* eigen.vec[;3] - eigen.val[3]*eigen.vec[;3]
           9.71e-17 + 0i
          -1.39e-16 + 0i
          -1.11e-16 + 0i
\end{verbatim}

See also: Page~\pageref{fn:eign} \verb+eign()+,
Page~\pageref{fn:eigs} \verb+eigs()+.

\newpage




